<%--
  Created by IntelliJ IDEA.
  User: aming
  Date: 2022-08-03
  Time: 11:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>

    <script src="js/jquery-1.11.0.min.js"></script>
</head>
<body>
    ==============

    <button id="btn">发送跨域访问</button>
</body>

<script>
    $("#btn").click(function (){
        //发送异步请求
        // $.get("http://localhost/user/cross",{},function (data){
        //     alert(data)
        // });

        $.ajax({
            url:"http://localhost/user/cross2",
            type:"get",
            success:function (data){
                alert(data)
            },
            //发送异步请求时，携带cookie认证信息
            xhrFields: {
                withCredentials: true
            }
        });
    });
</script>
</html>
